package com.iplant.ams.service.po.dms;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.ams.service.po.ams.asset.AMSAssetStandardModel;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;

import java.io.Serializable;

@DBBasePO(TableName = "dms_device_model", Name = false, Code = false, Active = false,
        Schemas = DBSchemas.AMS, CheckName = {"StandardModelID"})
public class DMSDeviceModel extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;

    @DBCondition
    @DBField
    public int DeviceTypeID = 0;

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "dms_device_type", tableAsName = "d1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "DeviceTypeID")
    public String DeviceTypeName = "";

    /**
     * 标准型号编码
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "dms_device_type", tableAsName = "d1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "DeviceTypeID")
    public String DeviceTypeCode = "";

    @DBCondition
    @DBField
    public int StandardModelID = 0;

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public String Name = "";

    /**
     * 标准型号编码
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public String Code = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "AssetModel", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public String AssetModel = "";


    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Active", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public int Active = 0;


    public DMSDeviceModel(){
        super();
    }

    public DMSDeviceModel(AMSAssetStandardModel wAMSAssetStandardModel,DMSDeviceType wDMSDeviceType){
        super();

        Name=wAMSAssetStandardModel.Name;
        Code=wAMSAssetStandardModel.Code;
        StandardModelID=wAMSAssetStandardModel.ID;
        AssetModel=wAMSAssetStandardModel.AssetModel;
        Active=wAMSAssetStandardModel.Active;
        DeviceTypeID=wDMSDeviceType.ID;
        DeviceTypeName=wDMSDeviceType.Name;
        DeviceTypeCode=wDMSDeviceType.Code;
    }



    @JsonProperty("DeviceTypeID")
    public int getDeviceTypeID() {
        return DeviceTypeID;
    }

    public void setDeviceTypeID(int deviceTypeID) {
        DeviceTypeID = deviceTypeID;
    }

    @JsonProperty("DeviceTypeName")
    public String getDeviceTypeName() {
        return DeviceTypeName;
    }

    public void setDeviceTypeName(String deviceTypeName) {
        DeviceTypeName = deviceTypeName;
    }

    @JsonProperty("DeviceTypeCode")
    public String getDeviceTypeCode() {
        return DeviceTypeCode;
    }

    public void setDeviceTypeCode(String deviceTypeCode) {
        DeviceTypeCode = deviceTypeCode;
    }

    @JsonProperty("StandardModelID")
    public int getStandardModelID() {
        return StandardModelID;
    }

    public void setStandardModelID(int standardModelID) {
        StandardModelID = standardModelID;
    }

    @Override
    @JsonProperty("Name")
    public String getName() {
        return Name;
    }

    @Override
    public void setName(String name) {
        Name = name;
    }

    @Override
    @JsonProperty("Code")
    public String getCode() {
        return Code;
    }

    @Override
    public void setCode(String code) {
        Code = code;
    }

    @JsonProperty("AssetModel")
    public String getAssetModel() {
        return AssetModel;
    }

    public void setAssetModel(String assetModel) {
        AssetModel = assetModel;
    }

    @Override
    @JsonProperty("Active")
    public int getActive() {
        return Active;
    }

    @Override
    public void setActive(int active) {
        Active = active;
    }
}
